package com.labtalk.admin.pojo.common;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class PageVo<T> {

    @ApiModelProperty(value = "响应数据列表")
    private List<T> content;

    @ApiModelProperty(value = "当前页")
    private Long pageNo;

    @ApiModelProperty(value = "每页条数")
    private Long pageSize;

    @ApiModelProperty(value = "总条数")
    private Long total;

    public PageVo(Page<T> p) {
        this.content = p.getRecords();
        this.pageNo = p.getCurrent();
        this.pageSize = p.getSize();
        this.total = p.getTotal();
    }
}
